﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using HotelManagement.DTO;

namespace HotelManagement.DAO
{
    class ServiceDAO:DataProvider
    {
        public ServiceDAO()
            :base()
        {

        }

        public bool Insert(ServiceDTO service)
        {
            string strInsert = "insert into service(ServiceName,Unit,Price) values (";
            strInsert += "N'" + service.ServiceName + "',";
            strInsert += "N'" + service.Unit + "',";
            strInsert += service.Price + ")";
            return base._ExecuteQuery(strInsert);
        }

        public bool Update(ServiceDTO service)
        {
            string strUpdate = "update service set";
            strUpdate += " service.ServiceName= N'" + service.ServiceName + "',";
            strUpdate += " service.Unit = N'" + service.Unit + "',";
            strUpdate += " service.Price = " + service.Price;
            strUpdate += " where service.ServiceID = " + service.ServiceID;
            return base._ExecuteQuery(strUpdate);
        }

        public DataTable Select()
        {
            string strSelect = "select * from service";
            return base._Select(strSelect);
        }

    }
}
